# -*- encoding=utf8 -*-
"""
RedFlag-TC000081   拍照闪光灯为止检查检查
拍照时检查闪光灯场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("--------------------------------拍照时检查闪光灯场景--------------------------------------")
"""
进入拍照
切换为后置摄像头
断言
点击翻转
断言
"""

shooter.enter_photo()
shooter.ensure_back_camera()
name = shooter.get_element_name(shooting_page_side_function_bar.child()[1])
shooter.assert_texts_equal(name, "cn.migu.video.clip.walle:id/clip_rc_btn_light_container", "断言失败，预期文本与实际文本不匹配")
shooter.click_element(shooting_page_rollover_Button)
sleep(2.0)
shooter.assert_element_not_exists(poco("cn.migu.video.clip.walle:id/clip_rc_btn_light_img"), "断言失败，前置摄像头发现闪光灯图标")

# 关闭应用
stop_app(UGC_package_name)